<?php
if(!defined('BASEPATH')) exit('No direct script access allowed');

// +----------------------------------------------------------------------+
// | Authors	: Tung, Nguyen Dam                                        |
// | Email		: mask_final@yahoo.com									  | 								
// | Mobile		: (+84) 936 885 466                                       |
// | Date		: 06/2011												  |							
// +----------------------------------------------------------------------+
// | Copyrights (C) 2011                                                  |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+

if(!function_exists('editor')){
    function editor($param = array(), $type = 'FCK', $configs = array()){        
		switch ($type){
			default:
				include('plugins/editors/fckeditor/fckeditor.php');	
				$path 					= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
				$path 					= substr( $path, 0, strpos( $path, "index" ) )."plugins/editors/fckeditor/";
				
				$editor					= new FCKeditor('');
				$editor->BasePath 		= $path;
				$editor->Height 		= $param['height'];				
				$editor->Config			= array(
											'AutoDetectLanguage' 	=> false,
											'DefaultLanguage'		=> 'en',
											'SkinPath'				=> $path . 'editor/skins/' . htmlspecialchars("office2003") . '/'
											);
											
				$editor->InstanceName 	= $param['name'];							
				$editor->Value			= $param['content'];
				$editor->Create();								
				break;
		}
    }   
}
